FROM openjdk:8-alpine3.9
# 作者信息
MAINTAINER Dingcy Docker skywalking springboot "1249774208@qq.com"
# 修改源
RUN echo "https://mirrors.aliyun.com/alpine/v3.6/main/" > /etc/apk/repositories && \
echo "https://mirrors.aliyun.com/alpine/v3.6/community/" >> /etc/apk/repositories
# 安装需要的软件，解决时区问题
RUN apk --update add curl bash tzdata && \
rm -rf /var/cache/apk/*
#修改镜像为东八区时间
ENV TZ Asia/Shanghai

COPY apache-skywalking-apm-bin/agent/ /opt/skyagent/

VOLUME  /tmp
ARG JAR_FILE
ARG SERVICE_NAME
ARG SERVICE_PORT
COPY ${JAR_FILE} app.jar

EXPOSE ${SERVICE_PORT}

ENV AGENT_COLLECTOR_ADDRESS="192.168.80.151:11800" AGENT_SERVICE_NAME=${SERVICE_NAME}
ENTRYPOINT java -javaagent:/opt/skyagent/skywalking-agent.jar=agent.service_name=${AGENT_SERVICE_NAME},collector.backend_service=${AGENT_COLLECTOR_ADDRESS} ${JAVA_OPTS} -jar /app.jar
